#!/usr/bin/env python3
"""Django's command-line utility for administrative tasks."""
import os
import sys

# 确保中文显示正常（Python 3 默认支持 UTF-8，但 Windows 可能需要额外设置）
try:
    import locale
    locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
except:
    pass

# 添加项目路径到系统路径
sys.path.append("..")
sys.path.append("D:\\cdsswkspace\\medical-knowledge-graph\\mysite")
sys.path.append("D:\\cdsswkspace\\medical-knowledge-graph\\mysite\\mysite")

def main():
    """Run administrative tasks."""
    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
    try:
        from django.core.management import execute_from_command_line
    except ImportError as exc:
        raise ImportError(
            "Couldn't import Django. Are you sure it's installed and "
            "available on your PYTHONPATH environment variable? Did you "
            "forget to activate a virtual environment?"
        ) from exc
    execute_from_command_line(sys.argv)

if __name__ == '__main__':
    # 修改默认地址和端口（Python 3 兼容写法）
    from django.core.management.commands.runserver import Command as Runserver
    Runserver.default_addr = '0.0.0.0'
    Runserver.default_port = '8086'
    main()   